import List from "@/model/list";
import {FormInstance} from "element-plus";

export default class Search {

    info: any;
    list?: List;

    constructor({
                    info = {},
                    list = undefined,
                    searchRef = undefined,
                }: {
        list?: List,
        info?: any,
        searchRef?: any,
    }) {
        this.list = list
        this.info = info
    }

    submit() {
        // 添加查询条件
        if(this.list) this.list.where = Object.assign(this.list.where, this.info)
        this.list?.reload(1)
    }

    reset(searchRef: FormInstance | undefined) {
        searchRef?.resetFields()
    }


}
